package cn.rkylin.oms.warehouse.extAdjust.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import cn.rkylin.core.IDataBaseFactory;
import cn.rkylin.oms.warehouse.extAdjust.vo.AdjustVO;

/**
 * Created by Administrator on 2018-4-16.
 */
@Repository(value = "adjustDAO")
public class AdjustDAOImpl implements IAdjustDAO {
    @Autowired
    protected IDataBaseFactory dao;

    @Override
    public int insert(AdjustVO adjustVO) throws Exception {
        return dao.insert("insertSelectiveAdjust", adjustVO);
    }

    @Override
    public int update(AdjustVO adjustVO) throws Exception {
        return dao.update("updateByPrimaryKeySelectiveAdjust",adjustVO);
    }

    @Override
    public AdjustVO findById(String id) throws Exception {
        List<AdjustVO> resultList = dao.findList("selectByPrimaryKeyAdjust", id);
        if (resultList != null && resultList.size() > 0) {
            return resultList.get(0);
        }
        return null;
    }

    @Override
    public int getUnGoingCount(Map paramMap) throws Exception {
        return dao.findOne("getUnGoingCountByGoodsId", paramMap );
    }
}
